home *** CD-ROM | disk | FTP | other *** search
/ Trusted Irix /B 4.0.4 / Trusted-Irix B-4.0.1.iso / dist / eoe1.idb / usr / include / sys / types.h.z / types.h
C/C++ Source or Header  |  1992-04-03  |  4KB  |  118 lines

  1. /**************************************************************************
  2.  *                                      *
  3.  *          Copyright (C) 1990, Silicon Graphics, Inc.          *
  4.  *                                      *
  5.  *  These coded instructions, statements, and computer programs  contain  *
  6.  *  unpublished  proprietary  information of Silicon Graphics, Inc., and  *
  7.  *  are protected by Federal copyright law.  They  may  not be disclosed  *
  8.  *  to  third  parties  or copied or duplicated in any form, in whole or  *
  9.  *  in part, without the prior written consent of Silicon Graphics, Inc.  *
  10.  *                                      *
  11.  **************************************************************************/
  12. /*    Copyright (c) 1984 AT&T    */
  13. /*      All Rights Reserved      */
  14.  
  15. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T    */
  16. /*    The copyright notice above does not evidence any       */
  17. /*    actual or intended publication of such source code.    */
  18.  
  19. #ifndef __SYS_TYPES_H__
  20. #define __SYS_TYPES_H__
  21. #pragma once
  22. #ident    "$Revision: 3.17 $"
  23.  
  24. typedef    struct { int r[1]; } *    physadr;
  25. typedef    long        daddr_t;    /* <disk address> type */
  26. typedef    char *        caddr_t;    /* ?<core address> type */
  27. typedef    unsigned char    unchar;
  28. typedef    unsigned short    ushort;
  29. typedef    unsigned int    uint;
  30. typedef    unsigned long    ulong;
  31. typedef    ulong        ino_t;        /* <inode> type */
  32. typedef    short        cnt_t;        /* ?<count> type */
  33. #ifndef _TIME_T_
  34. #define _TIME_T_
  35. typedef    long        time_t;        /* <time> type */
  36. #endif /* !_TIME_T_ */
  37. typedef    int        label_t[12];    /* sync with NJBREGS in pcb.h */
  38. typedef    short        dev_t;        /* <old device number> type */
  39. typedef    long        off_t;        /* ?<offset> type */
  40. typedef    unsigned long    paddr_t;    /* <physical address> type */
  41. typedef    int        key_t;        /* IPC key type */
  42. typedef    unsigned char    use_t;        /* use count for swap.  */
  43. typedef    short        sysid_t;
  44. typedef    short        index_t;
  45. typedef unsigned int    lock_t;        /* <spinlock> type */
  46. typedef    signed char    cpuid_t;    /* cpuid */
  47. #ifndef _SIZE_T_
  48. #define _SIZE_T_
  49. typedef unsigned size_t;    /* the unsigned integral type of the result
  50.                    of the sizeof operator */
  51. #endif /* !_SIZE_T_ */
  52.  
  53. #ifdef _BSD_COMPAT
  54. /*
  55.  * Basic system types from 4.2 (Needed for 4.2 driver ports)
  56.  *  ( internal major/minor device constructing/busting macros
  57.  *    that are used in the kernel are found in sys/sysmacros.h )
  58.  */
  59. /* major part of a device external from the kernel */
  60. #define    major(x)    (int)(((unsigned)(x)>>8)&0x7F)
  61.  
  62. /* minor part of a device */
  63. #define    minor(x)    (int)((x)&0xFF)
  64.  
  65. /* make a device number */
  66. #define    makedev(x,y)    (dev_t)(((x)<<8) | (y))
  67.  
  68. typedef    struct    _quad { long val[2]; } quad;
  69. #endif /* _BSD_COMPAT */
  70.  
  71. typedef    unsigned char    u_char;
  72. typedef    unsigned short    u_short;
  73. typedef    unsigned int    u_int;
  74. typedef    unsigned long    u_long;
  75.  
  76. typedef    long    swblk_t;
  77. typedef    u_short    uid_t;
  78. typedef    u_short    gid_t;
  79.  
  80. /* POSIX additions */
  81. typedef int    pid_t;        /* proc & grp IDs (NOT kernel internal!) */
  82. typedef short    nlink_t;    /* used for link counts */
  83. typedef    ushort    mode_t;        /* file attrs, eg. file type, access perms */
  84.  
  85. #define    NBBY    8        /* number of bits in a byte */
  86.  
  87. /*
  88.  * Select uses bit masks of file descriptors in longs.
  89.  * These macros manipulate such bit fields (the filesystem macros use chars).
  90.  * FD_SETSIZE may be defined by the user, but the default here
  91.  * should be >= NOFILE (param.h).
  92.  */
  93. #ifndef    FD_SETSIZE
  94. #define    FD_SETSIZE    256
  95. #endif
  96.  
  97. #ifdef sgi
  98. typedef unsigned long fd_mask;
  99. #else
  100. typedef long    fd_mask;
  101. #endif /* sgi */
  102.  
  103. #define NFDBITS    (sizeof(fd_mask) * NBBY)    /* bits per mask */
  104. #ifndef howmany
  105. #define    howmany(x, y)    (((x)+((y)-1))/(y))
  106. #endif
  107.  
  108. typedef    struct fd_set {
  109.     fd_mask    fds_bits[howmany(FD_SETSIZE, NFDBITS)];
  110. } fd_set;
  111.  
  112. #define    FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
  113. #define    FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
  114. #define    FD_ISSET(n, p)    ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
  115. #define FD_ZERO(p)    bzero((char *)(p), sizeof(*(p)))
  116.  
  117. #endif /* __SYS_TYPES_H__ */
  118.